<template>
  <div class="app-container">
    <!--表单-->
    <el-form :inline="true" class="demo-form-inline">

      <el-form-item label="日期">
        <el-date-picker
          v-model="day"
          type="date"
          placeholder="选择要统计的日期"
          value-format="yyyy-MM-dd" />
      </el-form-item>


      <el-button
        :disabled="btnDisabled"
        type="primary"
        @click="create()">生成</el-button>
    </el-form>

  </div>
</template>
<script>
import statistics from '@/api/edu/statistics'
export default{
    data(){
        return {
            day:'',
            btnDisabled:false
        }
    },
    created(){

    },
    methods:{
        create(){
            this.btnDisabled=true //禁止重复提交
            statistics.createStatisticsData(this.day)
            .then(response=>{
                //提示信息
                this.$message({
                    type:'success',
                    message:'生成图表成功'
                })
                //路由跳转,就是在路由里面的设置,/router/index中展示图表的路由设置
                this.$router.push({path:'/statistics/show'})
            })
        }
    }

}

</script>